"""
此处存放公共功能
"""

from conf import settings

# 装饰器
def login_auth(func):
    from core import src
    def inner(*args,**kwargs):

        if src.login_user:
            res = func(*args,**kwargs)
            return res

        else:
            print('请先登录，再享受服务~~')
            src.login()

    return inner

# 添加日志功能
def append_logger(log_data):
    # 写入日志数据
    with open(settings.LOG_PATH,'a',encoding='utf-8') as f:
        f.write(log_data + '\n')
